package pers.litao.bit.product.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import pers.litao.bit.commons.entities.priduct.LabelEntity;
import pers.litao.bit.commons.utils.R;
import pers.litao.bit.commons.utils.SysUtil;
import pers.litao.bit.product.dao.LabelMapper;
import pers.litao.bit.product.service.LabelService;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 李涛
 * @date 2020-11-26 15:37
 */
@Service
@Slf4j
public class LabelServiceImpl extends ServiceImpl<LabelMapper, LabelEntity> implements LabelService {
    @Override
    public void init() {
        List<LabelEntity> entities = new ArrayList<>();
        entities.add(new LabelEntity(null,"进口零食",0,null));
        entities.add(new LabelEntity(null,"食品饮料",0,null));
        entities.add(new LabelEntity(null,"美容洗护",0,null));
        entities.add(new LabelEntity(null,"家庭清洁",0,null));
        entities.add(new LabelEntity(null,"母婴用品",0,null));
        entities.add(new LabelEntity(null,"家具家电",0,null));
        entities.add(new LabelEntity(null,"生活电器",0,null));
        entities.add(new LabelEntity(null,"办公用品",0,null));
        this.saveBatch(entities);
    }

    /**
     * 获取分类列表
     *
     * @return
     */
    @Override
    public R getList() {
        log.info("用户请求成功" + SysUtil.getClientInfo().buildInfo());
        List<LabelEntity> list = this.list();
        return R.ok(list);
    }
}
